package com.briup.shopadmin.web.controller;

import com.briup.shopadmin.common.Result;
import com.briup.shopadmin.common.bean.Admin;
import com.briup.shopadmin.service.IAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("admin")
@Api(tags = "管理员相关接口")
public class AdminController {
    @Autowired
    IAdminService adminService;

    @PostMapping("login")
    @ApiOperation("管理员登录")
    public Result  login(@RequestBody Admin admin){
        Map<String, String> map = adminService.login(admin.getUsername(), admin.getPassword());
        return  Result.success(map);

    }
}
